import re

def load_config(fn):
    config = {}
    p_num = re.compile(r"^\d+(?:\.\d+)?$")
    with open(fn) as f:
        for line in f:
            line = line.strip()
            if not line or line.startswith("#"):
                continue
            k, v = re.split(r"\s*=\s*", line)
            if p_num.match(v):
                v = float(v)
            config[k] = v
    return config